import {Sequelize, Model} from "sequelize";
import sequelize from "../libs/db";

class Music extends Model {

}

Music.init(
{
		id: {
			type: Sequelize.INTEGER,
			primaryKey: true,
			autoIncrement: true,
		},
		image: {
			type: Sequelize.STRING(64)
		},
		content: {
			type: Sequelize.STRING(300),
				allowNull: true
		},
		url: {
			type: Sequelize.STRING(100),
				allowNull: true
		},
		pubdate: {
			type: Sequelize.DATE,
				allowNull: true
		},
		fav_nums: {
			type: Sequelize.INTEGER,
				defaultValue: 0,
		},
		type: {
			type: Sequelize.INTEGER,
		},
		title: {
			type: Sequelize.STRING(50),
		},
		status: {
			type: Sequelize.INTEGER,
		}
	}, {
		tableName: 'music',
			modelName: 'music',
			paranoid: true,
			underscored: true,
			timestamps: true,
			createAt: 'created_at',
			updateAt: 'updated_at',
			deletedAt: 'deleted_at',
			sequelize
	}
)

export {Music as MusicModel}
